<html>
<title>web rtc example 1</title>
<body>
<div id="log">


</div>

</body>
<script>
var logElement = document.querySelector('#log');

function logMsg(msg, error) {
  logElement.innerHTML += '<p>' + msg + '</p>';
  if (typeof error !== 'undefined') {
    console.error(error);
  }
}


const constraints = {
    'video': true,
    'audio': true
}
navigator.mediaDevices.getUserMedia(constraints)
.then(stream => {
    console.log('Got MediaStream:', stream);
    logMsg(stream)
})
.catch(error => {
    console.error('Error accessing media devices.', error);
});
</script>

</html>